package com.example.myfirstapplication;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    //定义button按键属性
    private Button mBtnTextView;
    private Button mBtnButton;
    private Button mBtnEditText;
    private Button mBtnSqllite;
    @Override
    protected  void onCreate(Bundle savdInstanceState){
        super.onCreate(savdInstanceState);
        setContentView(R.layout.activity_main);
        //获取具体的按键
        mBtnTextView = findViewById(R.id.btn_textview);
        mBtnButton = findViewById(R.id.btn_button);
        mBtnEditText = findViewById(R.id.btn_edittext);
        mBtnSqllite = findViewById(R.id.btn_sqllite);
        //通过按键跳转到textview
        mBtnTextView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                //跳转到TextView演示
                Intent intent = new Intent(MainActivity.this, TextViewActivity.class);
                startActivity(intent);
            }
        });
        //通过button按键跳转到button界面
        mBtnButton.setOnClickListener(new OnClickListener() {
           //跳转到button页面
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, ButtonActivity.class);
                startActivity(intent);
            }
        });

        //通过button按键跳转到EditText界面
        mBtnEditText.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(MainActivity.this,EditTextActivity.class);
                startActivity(intent);
            }
        });

        //通过button按键跳转到使用sqlliet存储数据的学生管理系统页面;
        mBtnSqllite.setOnClickListener(new OnClickListener(){
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, SqlLiteActivity.class);
                startActivity(intent);
            }
        });
    }

}
